/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
package web.app.client;


import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;


public class AppController extends Controller {

  private AppView appView;

  public AppController() {
    registerEventTypes(AppEvents.Init);
    registerEventTypes(AppEvents.Error);
  }

  public void handleEvent(AppEvent event) {
    
    EventType type = event.getType();
    if (type == AppEvents.Init) {
      forwardToView(appView, event);

    }else if(type == AppEvents.Error){
        System.out.println("error: " + event.<Object>getData());
    }

  }
  
  @Override public void initialize() {
    appView = new AppView(this);
  }

}
